<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>闭包思考</title>
		<script type="text/javascript">
			
//			var name = 'The windows';
//			var obj = {
//				name:'my Object',
//				getNameFunction:function() {
//					return function() {
//						return this.name;
//					}
//				}
//			}
//			console.log(obj.getNameFunction()());// The windows
			
			//闭包
			var name = 'The window';
			var obj = {
				name:'my object',
				getNameFunction:function() {
					var that = this;
					return function() {
						return that.name;
					}
				}
			}
			console.log(obj.getNameFunction()()); // my object
			while(true){
				for(var i = 0; i< 100; i++) {
					console.log(1)
				}
			}
			
		</script>
	</head>
	<body>
	</body>
</html>
